package com.zhangtai.modules.controller.admin;

import java.util.Arrays;
import java.util.Map;

import com.zhangtai.modules.entity.qw.QwSpItemsEntity;
import com.zhangtai.modules.service.qw.QwSpItemsService;
import com.zhangtai.modules.vo.QwCheckMonthVo;
import com.zhangtai.utils.PageUtils;
import com.zhangtai.utils.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author wanwgei
 * @email i@weiwang.com
 * @date 2021-05-24 16:27:47
 */
@Api(tags = "获取用户的假勤信息")
@RestController
public class QwSpItemsController {
    @Autowired
    private QwSpItemsService qwSpItemsService;


    @PostMapping("/qwspitems")
    public R getQwSpitms(@RequestBody QwCheckMonthVo qwCheckMonthVo) {

        return R.ok();
    }


    /**
     * 列表
     */
    @RequestMapping("/list")
    // @RequiresPermissions("coupon:qwspitems:list")
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = qwSpItemsService.queryPage(params);
        return R.ok(page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    // @RequiresPermissions("coupon:qwspitems:info")
    public R info(@PathVariable("id") Integer id) {
        QwSpItemsEntity qwSpItems = qwSpItemsService.getById(id);
        return R.ok(qwSpItems);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    // @RequiresPermissions("coupon:qwspitems:save")
    public R save(@RequestBody QwSpItemsEntity qwSpItems) {
        qwSpItemsService.save(qwSpItems);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    // @RequiresPermissions("coupon:qwspitems:update")
    public R update(@RequestBody QwSpItemsEntity qwSpItems) {
        qwSpItemsService.updateById(qwSpItems);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    // @RequiresPermissions("coupon:qwspitems:delete")
    public R delete(@RequestBody Integer[] ids) {
        qwSpItemsService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
